package com.cold.demo.webflux.exh;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Component
public class CommonExceptionHandler {

    private Logger log = LoggerFactory.getLogger(CommonExceptionHandler.class);
    /**
     * 用于处理Controller下发生的所有异常
     *
     * @param ex
     * @return
     */
    @ExceptionHandler(Exception.class)
    public String exceptionHandler(Exception ex) {
        log.error("发生了异常。。。");
        ex.printStackTrace();
        return System.currentTimeMillis() + "\t@ExceptionHandler: " + ex.getClass().toGenericString();
    }

}
